package com.nowcoder.community.dao;

import com.nowcoder.community.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {

    User selectById(int id);

    @Select("SELECT * from nowcoder.user where username = #{username}")
    User selectByName(String username);

    @Select("SELECT * from nowcoder.user where email = #{email}")
    User selectByEmail(String email);

    int insertUser(User user);

    @Update("update nowcoder.user set status = #{status} where id = #{id}")
    int updateStatus(int id, int status);

    @Update("update nowcoder.user set header_url = #{headerUrl} where id = #{id}")
    int updateHeader(int id, String headerUrl);

    @Update("update nowcoder.user set password = #{password} where id = #{id}")
    int updatePassword(int id, String password);

}
